package com.mba.bean;

import org.json.JSONException;
import org.json.JSONObject;

import com.mba.util.Utility;

/*
 * resource class of Basic Info of User
 * 
 * Written by pansen at 2013/04/17
 * 
 */
public class UserBasic {
	/*
	 * ID of user
	 */
	private long userID;
	/*
	 * name of user
	 */
	private String userName;
	/*
	 * head Pic of user
	 */
	private String headPic;
	
	
	public UserBasic(JSONObject jsonObj)throws Exception{
		constructJson(jsonObj);
	}

	public UserBasic(long userID, String userName, String headPic) {
		super();
		this.userID = userID;
		this.userName = userName;
		this.headPic = headPic;
	}
	
	private void constructJson(JSONObject json) throws Exception {
		try {
			userID = Utility.getLong("id",json);
			userName=json.getString("name");
			headPic = json.getString("pic");
		} catch (JSONException je) {
			throw je;
		}
	}

	public long getUserID() {
		return userID;
	}

	public void setUserID(long userID) {
		this.userID = userID;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getHeadPic() {
		return headPic;
	}

	public void setHeadPic(String headPic) {
		this.headPic = headPic;
	}

}
